Skip to content

Commit c5cc60e

Browse files
committed
オプションの説明文を修正。デフォルトのテンプレートファイルを jar に同梱。
1 parent b2a16d0 commit c5cc60e

68 files changed

Lines changed: 6213 additions & 20 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/deviceconnect-codegen/src/main/java/org/deviceconnect/codegen/Const.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public final class Const {
2323
static final ResourceBundle MESSAGES = ResourceBundle.getBundle("Messages", Locale.getDefault(),
2424
ResourceBundleWithUtf8.UTF8_ENCODING_CONTROL);
2525

26-
public static final Options OPTIONS = createOptions();
26+
public static final Options OPTIONS;
2727

2828
static Map<String, DConnectCodegenConfig> configs = new HashMap<String, DConnectCodegenConfig>();
2929

@@ -55,15 +55,16 @@ static DConnectCodegenConfig getConfig(String name) {
5555
}
5656
sb.append(config.getName());
5757
configs.put(config.getName(), config);
58-
configString = sb.toString();
5958
}
59+
configString = sb.toString();
60+
OPTIONS = createOptions();
6061
}
6162

6263
static List<DConnectCodegenConfig> getExtensions() {
6364
ServiceLoader<DConnectCodegenConfig> loader = ServiceLoader.load(DConnectCodegenConfig.class);
6465
List<DConnectCodegenConfig> output = new ArrayList<DConnectCodegenConfig>();
65-
for (DConnectCodegenConfig aLoader : loader) {
66-
output.add(aLoader);
66+
for (DConnectCodegenConfig config : loader) {
67+
output.add(config);
6768
}
6869
return output;
6970
}
@@ -72,27 +73,27 @@ private static Options createOptions() {
7273
Options options = new Options();
7374

7475
// Required
75-
options.addOption(option(true, "l", "lang", true, "client language to generate.\nAvailable languages include:\n\t[" + configString + "]"));
76-
options.addOption(option(true, "o", "output", true, "where to write the generated files"));
76+
options.addOption(option(true, "l", "lang", true, "client language to generate.\nAvailable languages include:\n\t[" + Const.configString + "]"));
77+
options.addOption(option(true, "o", "output", true, "where to write the generated files."));
7778
OptionGroup inputSpecOptions = new OptionGroup();
7879
inputSpecOptions.setRequired(true);
79-
inputSpecOptions.addOption(new Option("s", "input-spec-dir", true, "directory of the swagger specs"));
80-
inputSpecOptions.addOption(new Option("i", "input-spec", true, "location of the swagger spec, as URL, file or directory"));
80+
inputSpecOptions.addOption(new Option("s", "input-spec-dir", true, "directory of the swagger specs."));
81+
inputSpecOptions.addOption(new Option("i", "input-spec", true, "location of the swagger spec, as URL, file or directory."));
8182
options.addOptionGroup(inputSpecOptions);
8283

8384
// Optional
8485
options.addOption("h", "help", false, "shows this message");
85-
options.addOption("t", "template-dir", true, "folder containing the template files");
86-
options.addOption("d", "debug-info", false, "prints additional info for debugging");
86+
options.addOption("t", "template-dir", true, "folder containing the template files.");
87+
options.addOption("d", "debug-info", false, "prints additional info for debugging.");
8788
//options.addOption("a", "auth", true, "adds authorization headers when fetching the swagger definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values");
88-
options.addOption("c", "config", true, "location of the configuration file");
89-
options.addOption("p", "package-name", true, "package name (for deviceConnectAndroidPlugin only)");
90-
options.addOption("n", "display-name", true, "display name of the generated project");
91-
options.addOption("x", "class-prefix", true, "prefix of each generated class that implements a device connect profile");
92-
options.addOption("b", "connection-type", true, "connection type with device connect manager (for deviceConnectAndroidPlugin only)");
93-
options.addOption("r", "gradle-plugin-version", true, "version of Android Plugin for Gradle");
94-
options.addOption("k", "sdk", true, "location of Device Connect SDKs");
95-
options.addOption("g", "signing-configs", true, "location of singing configs");
89+
options.addOption("c", "config", true, "location of the configuration file.");
90+
options.addOption("p", "package-name", true, "package name (for Android only)");
91+
options.addOption("n", "display-name", true, "display name of the generated project.");
92+
options.addOption("x", "class-prefix", true, "prefix of each generated class that implements a device connect profile. (for Android and iOS only)");
93+
options.addOption("b", "connection-type", true, "specifies the connection type with device connect manager by \"binder\" or \"broadcast\"; The default value is \"broadcast\". (for Android only)");
94+
options.addOption("r", "gradle-plugin-version", true, "version of Android Plugin for Gradle. The default value is \"3.0.0\". (for Android only)");
95+
options.addOption("k", "sdk", true, "location of Device Connect SDKs.");
96+
options.addOption("g", "signing-configs", true, "location of singing configs.");
9697
options.addOption("w", "overwrite", false, "allow to delete a directory which exists already on the specified path by `output` option before output.");
9798

9899
return options;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# {{displayName}}
2+
3+
## 開発環境
4+
Android Studio 2.2.1以上
5+
6+
## サポートするプロファイル
7+
{{#supportedProfileNames}}
8+
- {{name}}
9+
{{/supportedProfileNames}}
10+
11+
## 要実装箇所
12+
下記のjavaファイルにTODOを記載しています。プラグインの要件に合わせて実装してください。
13+
14+
{{#supportedProfileClasses}}
15+
- {{name}}.java
16+
{{/supportedProfileClasses}}
17+
- {{messageServiceClass}}.java
18+
19+
20+
## 関連ページ
21+
- [Device Connect プラグイン開発マニュアル](https://github.com/DeviceConnect/DeviceConnect-Android/wiki/DevicePlugin-Manual-for-Android-Studio-110)
22+
23+
## テスト
24+
以下は config オプションのテストです。
25+
26+
testString: {{testString}}
27+
testInt: {{testInt}}
28+
testNumber: {{testNumber}}
29+
testBoolean: {{testBoolean}}
30+
testObject: {{#testObject}}{{objKey}}{{/testObject}}
31+
testArray: {{#testArray}}{{.}} {{/testArray}}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
storeFile=YOUR_STORE_FILE
2+
storePassword=YOUR_STORE_PASSWORD
3+
keyAlias=YOUR_KEY_ALIAS
4+
keyPassword=YOUR_KEY_PASSWORD
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
apply plugin: 'com.android.application'
2+
3+
dependencies {
4+
compile fileTree(include: '*.jar', dir: 'libs')
5+
compile 'org.deviceconnect:dconnect-device-plugin-sdk:{{{deviceConnectPluginSdkVersion}}}'
6+
}
7+
8+
repositories {
9+
maven { url 'https://raw.githubusercontent.com/DeviceConnect/DeviceConnect-Android/master/dConnectSDK/dConnectSDKForAndroid/repository/' }
10+
maven { url 'https://raw.githubusercontent.com/DeviceConnect/DeviceConnect-Android/master/dConnectDevicePlugin/dConnectDevicePluginSDK/repository/' }
11+
}
12+
13+
android {
14+
15+
compileSdkVersion {{compileSdkVersion}}
16+
buildToolsVersion '25.0.2'
17+
18+
defaultConfig {
19+
applicationId "{{invokerPackage}}"
20+
minSdkVersion {{minSdkVersion}}
21+
targetSdkVersion {{targetSdkVersion}}
22+
versionCode 1
23+
versionName '1.0.0'
24+
}
25+
26+
signingConfigs {
27+
releaseConfig {
28+
storeFile=file(project.properties.storeFile)
29+
storePassword=project.properties.storePassword
30+
keyAlias=project.properties.keyAlias
31+
keyPassword=project.properties.keyPassword
32+
}
33+
}
34+
35+
buildTypes {
36+
release {
37+
minifyEnabled false
38+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
39+
signingConfig signingConfigs.releaseConfig
40+
}
41+
}
42+
43+
packagingOptions {
44+
exclude 'LICENSE.txt'
45+
exclude 'META-INF/DEPENDENCIES'
46+
exclude 'META-INF/LICENSE'
47+
exclude 'META-INF/NOTICE'
48+
}
49+
50+
tasks.withType(JavaCompile) {
51+
options.encoding = 'UTF-8'
52+
}
53+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:{{{gradlePluginVersion}}}'
7+
}
8+
}
9+
10+
allprojects {
11+
repositories {
12+
jcenter()
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apply plugin: 'com.android.application'
2+
3+
dependencies {
4+
implementation fileTree(include: '*.jar', dir: 'libs')
5+
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:{{{deviceConnectPluginSdkVersion}}}'
6+
}
7+
8+
repositories {
9+
maven { url 'https://raw.githubusercontent.com/DeviceConnect/DeviceConnect-Android/master/dConnectSDK/dConnectSDKForAndroid/repository/' }
10+
maven { url 'https://raw.githubusercontent.com/DeviceConnect/DeviceConnect-Android/master/dConnectDevicePlugin/dConnectDevicePluginSDK/repository/' }
11+
}
12+
13+
android {
14+
15+
compileSdkVersion {{compileSdkVersion}}
16+
17+
defaultConfig {
18+
applicationId "{{invokerPackage}}"
19+
minSdkVersion {{minSdkVersion}}
20+
targetSdkVersion {{targetSdkVersion}}
21+
versionCode 1
22+
versionName '1.0.0'
23+
}
24+
25+
compileOptions {
26+
sourceCompatibility 1.8
27+
targetCompatibility 1.8
28+
}
29+
30+
signingConfigs {
31+
releaseConfig {
32+
storeFile=file(project.properties.storeFile)
33+
storePassword=project.properties.storePassword
34+
keyAlias=project.properties.keyAlias
35+
keyPassword=project.properties.keyPassword
36+
}
37+
}
38+
39+
buildTypes {
40+
release {
41+
minifyEnabled false
42+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
43+
signingConfig signingConfigs.releaseConfig
44+
}
45+
}
46+
47+
packagingOptions {
48+
exclude 'LICENSE.txt'
49+
exclude 'META-INF/DEPENDENCIES'
50+
exclude 'META-INF/LICENSE'
51+
exclude 'META-INF/NOTICE'
52+
}
53+
54+
tasks.withType(JavaCompile) {
55+
options.encoding = 'UTF-8'
56+
}
57+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
jcenter()
5+
}
6+
dependencies {
7+
classpath 'com.android.tools.build:gradle:{{{gradlePluginVersion}}}'
8+
}
9+
}
10+
11+
allprojects {
12+
repositories {
13+
google()
14+
jcenter()
15+
}
16+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ':plugin'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!gradle-wrapper.jar

0 commit comments

Comments
 (0)