Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defining the project archetype in a layer
- Loading branch information
1 parent
86c7002
commit 03c5e39
Showing
17 changed files
with
513 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/GradleArchetype.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.gradle.htmlui; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.util.Enumeration; | ||
import org.openide.filesystems.FileObject; | ||
import org.openide.filesystems.FileUtil; | ||
|
||
final class GradleArchetype { | ||
private final FileObject root; | ||
private final FileObject projectDir; | ||
|
||
GradleArchetype(FileObject root, FileObject projectDir) { | ||
this.root = root; | ||
this.projectDir = projectDir; | ||
} | ||
|
||
final void copyTemplates() throws IOException { | ||
Enumeration<? extends FileObject> en = root.getChildren(true); | ||
while (en.hasMoreElements()) { | ||
FileObject template = en.nextElement(); | ||
if (!template.isData()) { | ||
continue; | ||
} | ||
String relative = FileUtil.getRelativePath(root, template); | ||
FileObject destination = FileUtil.createData(projectDir, relative); | ||
try ( | ||
OutputStream os = destination.getOutputStream(); | ||
InputStream is = template.getInputStream() | ||
) { | ||
FileUtil.copy(is, os); | ||
} | ||
} | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/app_build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath "com.android.tools.build:gradle:2.3.0" | ||
} | ||
} | ||
|
||
def localProperties = new File(project.rootDir, "local.properties") | ||
if (System.getenv("ANDROID_HOME") == null && !localProperties.exists()) { | ||
return; | ||
} | ||
|
||
apply plugin: "com.android.application" | ||
|
||
def commonProject = project.parent | ||
|
||
dependencies { | ||
compile commonProject | ||
compile "com.dukescript.presenters:android:1.5.1" | ||
compile "org.netbeans.html:ko4j:1.6" | ||
} | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "25.0.3" | ||
sourceSets { | ||
main.assets.srcDirs += "${commonProject.projectDir}/src/main/webapp" | ||
println("after android" + main.assets.srcDirs); | ||
} | ||
defaultConfig { | ||
applicationId "com.kt.mvvm.demo" | ||
minSdkVersion 16 | ||
targetSdkVersion 16 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
packagingOptions { | ||
exclude 'META-INF/NOTICE' | ||
exclude 'META-INF/LICENSE' | ||
exclude 'META-INF/DEPENDENCIES' | ||
exclude 'META-INF/DISCLAIMER' | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
....htmlui/src/org/netbeans/modules/gradle/htmlui/resources/app_src_main_AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.kt.mvvm.demo"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="KtMvvmDemo" | ||
android:supportsRtl="true" | ||
> | ||
<activity android:name="com.dukescript.presenters.Android" | ||
android:configChanges="keyboardHidden|orientation|screenSize" | ||
> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<meta-data android:name="loadPage" android:value="file:///android_asset/pages/index.html"/> | ||
<meta-data android:name="loadClass" android:value="com.kt.mvvm.demo.Demo"/> | ||
<meta-data android:name="invoke" android:value="onPageLoad"/> | ||
</application> | ||
</manifest> |
23 changes: 23 additions & 0 deletions
23
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/desktop_build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'application' | ||
|
||
def commonProject = project.parent | ||
|
||
mainClassName = 'com.kt.mvvm.demo.DesktopMain' | ||
distributions { | ||
main { | ||
baseName = commonProject.name + '-desktop' | ||
contents { | ||
from "${commonProject.projectDir}/src/main/webapp/" | ||
} | ||
} | ||
} | ||
tasks.run { | ||
jvmArgs "-Dbrowser.rootdir=${commonProject.projectDir}/src/main/webapp/" | ||
} | ||
dependencies { | ||
compile commonProject | ||
compile "org.netbeans.html:net.java.html.boot:1.6" | ||
runtime "org.netbeans.html:net.java.html.boot.fx:1.6" | ||
} |
35 changes: 35 additions & 0 deletions
35
...ui/src/org/netbeans/modules/gradle/htmlui/resources/desktop_src_main_java_DesktopMain.fmk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (C) 2017 Anton Epple <toni.epple@eppleton.de> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package com.kt.mvvm.demo; | ||
|
||
import net.java.html.boot.BrowserBuilder; | ||
|
||
class desktop_src_main_java_DesktopMain { | ||
public static void main(String[] args) { | ||
BrowserBuilder.newBrowser().loadPage("pages/index.html") | ||
.loadFinished(Demo::onPageLoad) | ||
.showAndWait(); | ||
System.exit(0); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
action.run.args=bck2brwsrShow | ||
action.run.reload.rule=NEVER | ||
|
||
action.debug.args=run --debug-jvm | ||
action.debug.reload.rule=NEVER | ||
|
||
action.custom-1=Run in Browser | ||
action.custom-1.args=bck2brwsrShow | ||
action.custom-1.reload.rule=NEVER |
57 changes: 57 additions & 0 deletions
57
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/layer.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" | ||
"http://www.netbeans.org/dtds/filesystem-1_2.dtd"> | ||
<filesystem> | ||
<folder name="Templates"> | ||
<folder name="Project"> | ||
<folder name="Gradle"> | ||
<folder name="org-netbeans-modules-gradle-htmlui-HtmlJavaApplicationProjectWizard.dir"> | ||
<file name="build.gradle" url="root_build.gradle"/> | ||
<file name="gradle.properties" url="gradle.properties"/> | ||
<file name="settings.gradle" url="settings.gradle"/> | ||
<folder name="app"> | ||
<file name="build.gradle" url="app_build.gradle"/> | ||
<folder name="src"> | ||
<folder name="main"> | ||
<file name="AndroidManifest.xml" url="app_src_main_AndroidManifest.xml"/> | ||
</folder> | ||
</folder> | ||
</folder> | ||
<folder name="desktop"> | ||
<file name="build.gradle" url="desktop_build.gradle"/> | ||
<folder name="src"> | ||
<folder name="main"> | ||
<folder name="java"> | ||
<file name="DesktopMain.java" url="desktop_src_main_java_DesktopMain.fmk"/> | ||
</folder> | ||
<folder name="webapp"> | ||
<folder name="pages"> | ||
<file name="index.css" url="src_main_webapp_pages_index.css"/> | ||
<file name="index.html" url="src_main_webapp_pages_index.html"/> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
<folder name="web"> | ||
<file name="build.gradle" url="web_build.gradle"/> | ||
<folder name="src"> | ||
<folder name="main"> | ||
<folder name="java"> | ||
<file name="BrowserMain.java" url="web_src_main_java_BrowserMain.fmk"/> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
<folder name="src"> | ||
<folder name="main"> | ||
<folder name="java"> | ||
<file name="Demo.java" url="src_main_java_Demo.fmk"/> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</folder> | ||
</filesystem> |
24 changes: 24 additions & 0 deletions
24
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/root_build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
plugins { | ||
id "me.tatarka.retrolambda" version "3.7.0" | ||
} | ||
|
||
apply plugin: 'java' | ||
|
||
group 'com.dukescript.demo' | ||
version '1.0-SNAPSHOT' | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
targetCompatibility = '1.8' | ||
sourceCompatibility = '1.8' | ||
|
||
dependencies { | ||
compile "org.netbeans.html:net.java.html.json:1.6" | ||
compile "com.dukescript.api:javafx.base:8.60.11" | ||
compile "com.dukescript.api:javafx.beaninfo:0.5" | ||
runtime "org.netbeans.html:ko4j:1.6" | ||
} |
5 changes: 5 additions & 0 deletions
5
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include 'desktop' | ||
include 'app' | ||
include 'web' | ||
include 'ios' | ||
|
63 changes: 63 additions & 0 deletions
63
groovy/gradle.htmlui/src/org/netbeans/modules/gradle/htmlui/resources/src_main_java_Demo.fmk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (C) 2017 Anton Epple <toni.epple@eppleton.de> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package com.kt.mvvm.demo; | ||
|
||
import com.dukescript.api.javafx.beans.FXBeanInfo; | ||
import javafx.beans.binding.Bindings; | ||
import javafx.beans.binding.IntegerBinding; | ||
import javafx.beans.property.ListProperty; | ||
import javafx.beans.property.SimpleListProperty; | ||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
import javafx.collections.FXCollections; | ||
import static net.java.html.json.Models.applyBindings; | ||
|
||
public final class src_main_java_Demo implements FXBeanInfo.Provider { | ||
private final StringProperty desc = new SimpleStringProperty(this, "desc", "Buy Milk"); | ||
private final ListProperty<String> todos = new SimpleListProperty<>(this, "todos", FXCollections.observableArrayList()); | ||
private final IntegerBinding numTodos = Bindings.createIntegerBinding(todos::size, todos); | ||
|
||
void addTodo() { | ||
todos.getValue().add(desc.getValue()); | ||
desc.setValue(""); | ||
} | ||
|
||
private final FXBeanInfo info = FXBeanInfo.newBuilder(this) | ||
.property(desc) | ||
.property(todos) | ||
.property("numTodos", numTodos) | ||
.action("addTodo", this::addTodo) | ||
.build(); | ||
|
||
@Override | ||
public FXBeanInfo getFXBeanInfo() { | ||
return info; | ||
} | ||
|
||
public static void onPageLoad() { | ||
src_main_java_Demo model = new src_main_java_Demo(); | ||
applyBindings(model); | ||
} | ||
|
||
} |
Empty file.
Oops, something went wrong.