Skip to content

Commit 6fc5d58

Browse files
authored
Merge pull request #156 from Cognifide/develop
Release 3.1.2
2 parents 35d07fa + 05ebbd5 commit 6fc5d58

9 files changed

Lines changed: 34 additions & 15 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ buildscript {
115115
}
116116
117117
dependencies {
118-
classpath 'com.cognifide.gradle:aem-plugin:3.1.1'
118+
classpath 'com.cognifide.gradle:aem-plugin:3.1.2'
119119
}
120120
}
121121

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'com.cognifide.gradle'
9-
version '3.1.1'
9+
version '3.1.2'
1010
description = 'Gradle AEM Plugin'
1111
defaultTasks = ['clean', 'build', 'publishToMavenLocal']
1212

src/main/kotlin/com/cognifide/gradle/aem/api/AemConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ class AemConfig(
420420
* Declare new deployment target (AEM instance).
421421
*/
422422
fun localInstance(httpUrl: String) {
423-
instance(LocalInstance.create(httpUrl))
423+
localInstance(httpUrl, {})
424424
}
425425

426426
fun localInstance(httpUrl: String, configurer: LocalInstance.() -> Unit) {
@@ -456,7 +456,7 @@ class AemConfig(
456456
}
457457

458458
fun remoteInstance(httpUrl: String) {
459-
instance(RemoteInstance.create(httpUrl))
459+
remoteInstance(httpUrl, {})
460460
}
461461

462462
fun remoteInstance(httpUrl: String, configurer: RemoteInstance.() -> Unit) {

src/main/kotlin/com/cognifide/gradle/aem/instance/Instance.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,12 @@ interface Instance : Serializable {
124124
return filter(project, RemoteInstance::class)
125125
}
126126

127-
fun portOfUrl(url: String): Int {
128-
return URL(url).port
129-
}
130-
131127
}
132128

133129
val httpUrl: String
134130

135131
val httpPort: Int
136-
get() = portOfUrl(httpUrl)
132+
get() = InstanceUrl.parse(httpUrl).httpPort
137133

138134
val user: String
139135

src/main/kotlin/com/cognifide/gradle/aem/instance/InstanceType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum class InstanceType {
2121
}
2222

2323
fun byUrl(url: String): InstanceType {
24-
return byPort(Instance.portOfUrl(url))
24+
return byPort(InstanceUrl.parse(url).httpPort)
2525
}
2626

2727
fun byPort(port: Int): InstanceType {

src/main/kotlin/com/cognifide/gradle/aem/instance/InstanceUrl.kt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@ class InstanceUrl(raw: String) {
1515
get() = userPart(1) ?: Instance.PASSWORD_DEFAULT
1616

1717
val httpUrl: String
18-
get() = "${config.protocol}://${config.host}:${config.port}"
18+
get() = if (config.port != -1) {
19+
"${config.protocol}://${config.host}:${config.port}"
20+
} else {
21+
"${config.protocol}://${config.host}"
22+
}
23+
24+
val httpPort: Int
25+
get() = if (config.port != -1) {
26+
config.port
27+
} else {
28+
if (config.protocol == "https") {
29+
443
30+
} else {
31+
80
32+
}
33+
}
1934

2035
val typeName: String
2136
get() = InstanceType.nameByUrl(httpUrl)
@@ -24,7 +39,15 @@ class InstanceUrl(raw: String) {
2439
get() = InstanceType.byUrl(httpUrl)
2540

2641
val debugPort: Int
27-
get() = "1${Instance.portOfUrl(httpUrl)}".toInt()
42+
get() = if (config.port != -1) {
43+
"1$httpPort".toInt()
44+
} else {
45+
if (config.protocol == "https") {
46+
50443
47+
} else {
48+
50080
49+
}
50+
}
2851

2952
private fun userPart(index: Int): String? {
3053
return config.userInfo?.split(":")

src/test/resources/com/cognifide/gradle/aem/test/compose/assembly/gradle/buildscript.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repositories {
66
}
77

88
dependencies {
9-
classpath 'com.cognifide.gradle:aem-plugin:3.1.1'
9+
classpath 'com.cognifide.gradle:aem-plugin:3.1.2'
1010
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.5.0'
1111
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.21"
1212
}

src/test/resources/com/cognifide/gradle/aem/test/compose/bundle-and-content/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.cognifide.gradle:aem-plugin:3.1.1'
9+
classpath 'com.cognifide.gradle:aem-plugin:3.1.2'
1010
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.5.0'
1111
}
1212
}

src/test/resources/com/cognifide/gradle/aem/test/debug/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.cognifide.gradle:aem-plugin:3.1.1'
9+
classpath 'com.cognifide.gradle:aem-plugin:3.1.2'
1010
}
1111
}
1212

0 commit comments

Comments
 (0)