Merge branch 'BS-44'

This commit is contained in:
rzaitov 2013-11-14 16:03:39 +04:00
commit c2f6338103
18 changed files with 396 additions and 19 deletions

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotCompileApp", "NotCompile
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DroidApp", "DroidApp\DroidApp.csproj", "{10AA179F-818F-4E3F-947E-DE1C0C87BB76}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
@ -15,6 +17,14 @@ Global
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhone.Build.0 = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhone.ActiveCfg = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhone.Build.0 = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhone.ActiveCfg = Debug|iPhone
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhone.Build.0 = Debug|iPhone
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator

View File

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -23,7 +23,8 @@
<MtouchLink>None</MtouchLink>
<ConsolePause>false</ConsolePause>
<MtouchDebug>true</MtouchDebug>
<MtouchI18n />
<MtouchI18n>
</MtouchI18n>
<MtouchArch>ARMv7</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
@ -46,7 +47,8 @@
<MtouchDebug>true</MtouchDebug>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<IpaPackageName />
<IpaPackageName>
</IpaPackageName>
<CodesignProvision>F82B1481-F3D0-4CB5-AA6E-8B8D8E3A9DC1</CodesignProvision>
<BuildIpa>true</BuildIpa>
</PropertyGroup>
@ -59,8 +61,10 @@
<CodesignKey>iPhone Developer: Рустам Заитов (CTL85FZX6K)</CodesignKey>
<ConsolePause>false</ConsolePause>
<CodesignProvision>8F606DAE-F9C9-4A19-8EFF-34B990D76C28</CodesignProvision>
<IpaPackageName />
<MtouchI18n />
<IpaPackageName>
</IpaPackageName>
<MtouchI18n>
</MtouchI18n>
<MtouchArch>ARMv7</MtouchArch>
<BuildIpa>true</BuildIpa>
</PropertyGroup>

View File

@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Additionally, some Android functions will automatically load asset files:
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{10AA179F-818F-4E3F-947E-DE1C0C87BB76}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>DroidApp</RootNamespace>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>DroidApp</AssemblyName>
<TargetFrameworkVersion>v4.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Main.axml" />
<AndroidResource Include="Resources\values\Strings.xml" />
<AndroidResource Include="Resources\drawable\Icon.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project>

View File

@ -0,0 +1,35 @@
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace DroidApp
{
[Activity(Label = "DroidApp", MainLauncher = true)]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.myButton);
button.Click += delegate
{
button.Text = string.Format("{0} clicks!", count++);
};
}
}
}

View File

@ -0,0 +1,23 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("DroidApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("rzaitov")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.axml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.axml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

View File

@ -0,0 +1,112 @@
#pragma warning disable 1591
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.17020
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
[assembly: Android.Runtime.ResourceDesignerAttribute("DroidApp.Resource", IsApplication=true)]
namespace DroidApp
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
public partial class Resource
{
static Resource()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
public static void UpdateIdValues()
{
}
public partial class Attribute
{
static Attribute()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Attribute()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int Icon = 2130837504;
static Drawable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f050000
public const int myButton = 2131034112;
static Id()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Id()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int Main = 2130903040;
static Layout()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Layout()
{
}
}
public partial class String
{
// aapt resource value: 0x7f040001
public const int app_name = 2130968577;
// aapt resource value: 0x7f040000
public const int hello = 2130968576;
static String()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private String()
{
}
}
}
}
#pragma warning restore 1591

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/myButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Click Me!</string>
<string name="app_name">DroidApp</string>
</resources>

View File

@ -3,7 +3,7 @@
sh echo '{@sln_config}'
inside 'BuildSample/BuildSample.sln' remove NotCompileApp project
inside 'BuildSample/BuildSample.sln' remove 'NotCompileApp:DroidApp' project
inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output' for '{@sln_config}'
inside 'BuildSample/BuildSample/CoolApp.csproj' set AssemblyName to '{@assembly_name}' for ''

View File

@ -20,8 +20,8 @@ class RemoveProjectCommandBuilder:
parser = InsideRemoveParser('sln')
result = parser.parseLine(line)
slnPath = result[0]
projectName = result[1]
slnPath = result['file_path']
projectNames = result['names']
command = RemoveProjectCommand(slnPath, projectName)
command = RemoveProjectCommand(slnPath, projectNames)
return command

View File

@ -0,0 +1,21 @@
import unittest
from parsers.InsideParser.InsideRemoveParser import InsideRemoveParser
class TestInsideRemoveParser(unittest.TestCase):
def setUp(self):
self.parser = InsideRemoveParser('ext')
def test_parse(self):
self.check("inside 'Some/Path/file.ext' remove 'PROGECT' project", 'Some/Path/file.ext', ['PROGECT'])
self.check("inside 'file.ext' remove 'PR' projects", 'file.ext', ['PR'])
self.check("inside 'file.ext' remove 'PR' projects", 'file.ext', ['PR'])
self.check("inside 'file.ext' remove 'pr1:pr2:pr3' projects", 'file.ext', ['pr1', 'pr2', 'pr3'])
def check(self, line, filePath, expectedNames):
result = self.parser.parseLine(line)
self.assertEqual(filePath, result['file_path'])
self.assertListEqual(expectedNames, result['names'])

View File

@ -3,15 +3,15 @@ from utils.SlnPatcher import SlnPatcher
class RemoveProjectCommand(CommandBase):
def __init__(self, slnPath, projectName):
def __init__(self, slnPath, projectNames):
CommandBase.__init__(self)
assert slnPath is not None
assert projectName is not None
assert projectNames is not None
self.__slnPath = slnPath
self.__projectName = projectName
self.projectNames = projectNames
def execute(self):
patcher = SlnPatcher(self.__slnPath)
patcher.removeProjects([self.__projectName])
patcher.removeProjects(self.projectNames)

View File

@ -1,6 +1,7 @@
import re
from parsers.InsideParser.InsideParserBase import InsideParserBase
from parsers.RegexpBuilder import RegexpBuilder
from parsers.ValuesStriper import ValuesStripper
class InsideRemoveParser(InsideParserBase):
@ -11,20 +12,33 @@ class InsideRemoveParser(InsideParserBase):
match = self.fetchMatchFor(line)
filePath = match.group('file')
projectName = match.group('project')
projectNames = match.group('projects')
return filePath, projectName
names = self.parseNames(projectNames)
result = {
'file_path': filePath,
'names': names
}
return result
def getMatchInfo(self, line):
assert line is not None
filePathRegexp = r"'(?P<file>[./ a-zA-Z]+\.{0})'".format(self.fileExt)
projectNameRegexp = r'(?P<project>[.a-zA-Z]+)'
projectNameRegexp = r"'(?P<projects>[^']+)'"
rb = RegexpBuilder()
regexpSource = rb.startsWith('inside') + filePathRegexp + rb.keywordToken('remove') + projectNameRegexp + \
rb.spaceEndsWith('project')
rb.spaceEndsWith('project(s)?')
regexp = re.compile(regexpSource, re.UNICODE)
match = regexp.match(line)
return match, regexpSource
return match, regexpSource
def parseNames(self, namesStr):
vs = ValuesStripper()
names = vs.strip(namesStr)
return names

View File

@ -1,6 +1,7 @@
import re
from parsers.InsideParser.InsideParserBase import InsideParserBase
from parsers.RegexpBuilder import RegexpBuilder
from parsers.ValuesStriper import ValuesStripper
class InsideSetArrayParser(InsideParserBase):
@ -39,5 +40,7 @@ class InsideSetArrayParser(InsideParserBase):
assert valuesStr is not None
assert len(valuesStr) > 0
values = valuesStr.split(':')
vs = ValuesStripper()
values = vs.strip(valuesStr)
return values

View File

@ -0,0 +1,11 @@
class ValuesStripper:
def __init__(self):
pass
def strip(self, valueStr):
assert valueStr is not None
rawValues = valueStr.split(':')
values = [name.strip() for name in rawValues]
return values